package com.msa.msaportal.controller;

import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import net.sf.json.JSONArray;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.msa.msaportal.entity.UserComponent;
import com.msa.msaportal.service.IUserComponentService;

@Controller
@RequestMapping("/portal")
public class PortalTestController {
	@Resource(name="userComponentManager")
	private IUserComponentService userComponentManager;

	@RequestMapping("/test.do")
	public void showPortal(HttpServletRequest request, HttpServletResponse response, HttpSession session, ModelMap model) throws IOException {
		UserComponent userComponent=new UserComponent("1244","1888");
		UserComponent userComponent2=new UserComponent("1243","1888");
		UserComponent userComponent3=new UserComponent("1242","1888");
		UserComponent userComponent4=new UserComponent("1241","1888");
		UserComponent userComponent5=new UserComponent("123","19");
		UserComponent userComponent6=new UserComponent("123","20");
		UserComponent userComponent7=new UserComponent("123","21");
		/*userComponentManager.insertUserComponent(userComponent);
		userComponentManager.insertUserComponent(userComponent2);
		userComponentManager.insertUserComponent(userComponent3);
		userComponentManager.insertUserComponent(userComponent4);
		userComponentManager.insertUserComponent(userComponent5);
		userComponentManager.insertUserComponent(userComponent6);
		userComponentManager.insertUserComponent(userComponent7);
		UserComponent userComponent1=new UserComponent("123","18");
		userComponentManager.deleteUserComponent(userComponent1);*/
		System.out.println(JSONArray.fromObject(userComponentManager.getUserComponents("123")));
	}
}
